/*----------------------------------------------------------------------------
Owner(s): Shane Whitfield
$Copyright: $
$Id: 

Purpose  : 
----------------------------------------------------------------------------*/

#pragma once

#include "core.h"
#include "bbmath.h"
#include <vector>
#include "gomgr.h"

/*--------------------------------------------------------------------------*/
// Forward declarations
class CGoEnemy;

/*--------------------------------------------------------------------------*/
// Class CWorld declaration.
class CWave
{
public:
				CWave(const char* i_fileName, const Vector2f& i_pos);
				~CWave();
	static void	SetFileLoader(bool (*systemFileLoader)(const char* i_filename, CWave* io_level));
	void		Spawn();
	bool		IsComplete() const;
	void		On_Spawn(const char* i_classString, float i_x, float i_y);
	
private:

	class CSpawnCommand
	{
	public:
						CSpawnCommand(EClass i_class, const Vector2f& i_pos) {
							m_spawnedGo = NULL; m_spawnClass = i_class; m_posOffset = i_pos; }
		void			Execute(const Vector2f& i_waveOrigin);
		const CGoEnemy*	GetSpawnedGo() const {
							return m_spawnedGo; }
	private:
		EClass		m_spawnClass;
		Vector2f	m_posOffset;
		CGoEnemy*	m_spawnedGo;
	};

	enum EState
	{
		EState_Inactive,
		EState_Starting,
		EState_WaitingToStart,
		EState_WaitingCheckCompletion,
		EState_CheckCompletion,
		EState_Completed,
	};
	
	void	load(const char* i_fileName);
	
	float							m_tState;
	EState							m_state;
	std::vector<CSpawnCommand*>		m_spawnCommands;
	std::vector<const CGoEnemy*>	m_enemies;
	Vector2f						m_spawnLoc;
};

/*-----------------------------------EOF!-----------------------------------*/
